package com.yr.ryjk.to;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.yr.ryjk.common.Constant;
import com.yr.ryjk.interceptor.authority.For;
import com.yr.ryjk.interceptor.authority.UserType;
import com.yr.ryjk.sysuser.entity.Permission;
import com.yr.ryjk.sysuser.entity.SysUser;
import com.yr.ryjk.sysuser.service.ISuService;

/**
 * 页面跳转
 * @author Rick
 *
 */
@For(user=UserType.WEBSERVER_USER)
@Controller
@RequestMapping(method=RequestMethod.GET)
public class ToController {
	@Autowired
	private ISuService suService;
	
	/**
	 * 跳转到后台主页
	 * @return
	 */
	@RequestMapping("index.htm")
	public String toIndex(HttpServletRequest request){
		SysUser su=(SysUser)request.getSession().getAttribute(Constant.su_in_session);
		Permission permission=suService.getPermission(su.getSuName());
		if(permission!=null){
			String[] pArr=permission.getPermissions().split(",");
			for(String p:pArr){
				request.setAttribute(p, p);
			}
		}
		return "index";
	}
	
	/**
	 * 跳转到用户管理页
	 * @return
	 */
	@RequestMapping("user.htm")
	public String toUserList(){
		return "user/list";
	}
	/**
	 * 跳转到咨询管理页
	 * @return
	 */
	@RequestMapping("consult.htm")
	public String toConsultList(){
		return "consult/consult";

	}
	/**
	 * 跳转到科室管理页
	 * @return
	 */
	@RequestMapping("department.htm")
	public String toDepartmentList(){
		return "doctor/department";
	}
	
	/**
	 * 跳转到医生职务管理页
	 * @return
	 */
	@RequestMapping("duty.htm")
	public String toDutyList(){
		return "doctor/duty";
	}
	
	/**
	 * 跳转到科室管理页
	 * @return
	 */
	@RequestMapping("ads.htm")
	public String toAdsList(){
		return "ads/ads";
	}
	/**
	 * 跳转到节日管理页
	 * @return
	 */
	@RequestMapping("festival.htm")
	public String toFesList(){
		return "festival/festival";
	}
	
	/**
	 * 跳转到医生管理页
	 * @return
	 */
	@RequestMapping("doctor.htm")
	public String toDoctorList(){
		return "doctor/doctor";
	}
	
	/**
	 * 跳转到医院管理页
	 * @return
	 */
	@RequestMapping("hospital.htm")
	public String toHospitalList(){
		return "doctor/hospital";
	}
	
	/**
	 * 跳转到健康币管理页
	 * @return
	 */
	@RequestMapping("param.htm")
	public String toParams(){
	   return "setting/param";
	}
	/**
	 * 跳转到系统用户管理页面
	 * @return
	 */
	@RequestMapping("sysuser.htm")
	public String toSysUser(){
		return "setting/sysuser";
	}
	/**
	 * 跳转到修改密码页面
	 * @return
	 */
	@RequestMapping("changepw.htm")
	public String toChangepw(){
		return "setting/changepw";
	}
	/**
	 * 跳转到app版本管理
	 * @return
	 */
	@RequestMapping("app.htm")
	public String toApp(){
		return "setting/app";
	}
	
	/**
	 * 跳转到个人测试管理页
	 * @return
	 */
	@RequestMapping("testType.htm")
	public String toTest(){
		return "test/testType";
	}
	
	/**
	 * 试卷管理页面
	 * @return
	 */
	@RequestMapping("test.htm")
	public String toPaper(){
		return "test/test";
	}
	
	/**
	 * 跳转到测试题目管理页
	 * @return
	 */
	@RequestMapping("question.htm")
	public String toQuestion(){
		return "test/question";
	}
	
	/**
	 * 测试结果页
	 * @return
	 */
	@RequestMapping("result.htm")
	public String toResult(){
		return "test/result";
	}
	
	/**
	 * 名医分类页面
	 * @return
	 */
	@RequestMapping("expert.htm")
	public String toExpertType(){
		return "expertType/expertType";
	}
	
	/**
	 * 提现页面
	 * @return
	 */
	@RequestMapping("cashout.htm")
	public String toSysCashOut(){
		return "cashOut/cashOut";
	}
	/**
	 * 充值记录页面
	 * @return
	 */
	@RequestMapping("cashin.htm")
	public String toRecharge(){
		return "cashIn/cashIn";
	}
	/**
	 * 后门页面
	 * @return
	 */
	@RequestMapping("backdoor.htm")
	public String toBackdoor(){
		return "backDoor/backDoor";
	}
}